<template>
  <div>
    <FormItem
      :label="label"
      :prop="prop"
      :label-width="labelWidth"
      :rules="rules"
    >
      <DatePicker
        style="width: 100%"
        type="datetimerange"
        :placeholder="placeholder ? placeholder : '请选择时间'"
        :size="size"
        :disabled="disabled"
        @on-change="onChange"
      ></DatePicker>
    </FormItem>
  </div>
</template>

<script>
import commonItem from './commonItem'
export default {
  name: 'DateItem',
  mixins: [commonItem],
  methods: {
    onChange (o) {
      let [start, end] = o
      if (end) {
        end = end.replace('00:00:00', '23:59:59')
      }
      let d = [start, end]
      this.$emit('input', d)
    }
  }
}
</script>
